package com.ds.infrastructure.hyperspace.common;

/**
 * @author  Weishaoying
 */
public enum StateEnum {

    /**
     * Request bad
     */
    REQUEST_BAD(400, 9,"Request was bad!"),

    /**
     * Request not accept
     */
    REQUEST_BLOCKED(403, 16,"Request was blocked!"),

    /**
     * Request not accept
     */
    REQUEST_NOT_ACCEPTABLE(403,16, "Request not acceptable!"),

    /**
     * Request timeout
     */
    REQUEST_TIMEOUT(408, 4,"Request timeout!"),

    /**
     * Target server error
     */
    TARGET_SERVER_ERROR(500, 13,"Target server error!"),

    /**
     * Client has closed connection!
     */
    CLIENT_CLOSED_CONNECTION(499, 10,"Client has closed connection!"),

    /**
     * Gateway occur error
     */
    GATEWAY_ERROR(502, 13,"Gateway error!"),

    /**
     * All backend service unavailable
     */
    TARGET_ENDPOINT_UNAVAILABLE(503, 14,"Service unavailable!"),

    /**
     * Target stream not found
     */
    TARGET_ENDPOINT_STREAM_UNAVAILABLE(503, 14,"Target stream unavailable!"),

    /**
     * Target node not found
     */
    TARGET_ENDPOINT_NODE_NOT_FOUND(503, 14,"Target node not found!"),

    /**
     * http2 code 7:REFUSED_STREAM
     * Received Rst Stream
     */
    TARGET_STREAM_CANCEL(7, 8,"Target cancel,received Rst Stream !");

    private int httpCode;

    private int grpcCode;

    private String message;


    public int getHttpCode() {
        return httpCode;
    }

    public int getGrpcCode() {
        return grpcCode;
    }

    public String getMessage() {
        return message;
    }


    StateEnum(int httpCode, int grpcCode,String message) {
        this.httpCode = httpCode;
        this.grpcCode=grpcCode;
        this.message = message;
    }

}
